import { ListenEventType, TouchEventType } from "../../util/defineConfig";
import View from "../../util/View";
import gamePanel from "./gamePanel";

const { ccclass, property } = cc._decorator;

// 游戏结束面板
@ccclass
export default class gameoverPanel extends View {

    private view: any = null
    init(gamePanel: gamePanel, isWin: boolean) {
        this.view = this.load_all_object(this.node, '')
        if (isWin) {
            this.view['tip/win'].active = true
            this.view['tip/fail'].active = false
        } else {
            this.view['tip/win'].active = false
            this.view['tip/fail'].active = true
        }
        this.node.on(TouchEventType.touchStart, this.touch, this)
    }

    private touch() {
        this.emit(ListenEventType.RESTART_GAME)
    }

}
